package com.winit.tree.service;

import com.winit.tree.manager.TreeManager;
import com.winit.tree.model.TreeNode;
import com.winit.tree.model.TreeType;
import com.winit.tree.repository.TreeRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class FlowFrameServiceImpl implements IFlowFrameService {

    private static Logger log = LoggerFactory.getLogger(IFlowFrameService.class);

    @Autowired
    private TreeManager treeManager;
    @Autowired
    private TreeRepository treeRepository;

    @Override
    public TreeNode getFlowFrameTree(String flowFrameId) {
        return this.treeManager.getTree(flowFrameId, TreeType.FLOW_FRAME);
    }

    @Override
    public List<TreeNode> getAllFlowFrame() {
        return this.treeManager.getAllFlowFrame();
    }

    @Override
    public TreeNode getFlowFrameById(String flowFrameId) {
        return this.treeRepository.findOne(flowFrameId);
    }
}
